package com.example.administrator.baikangxing.holder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.baikangxing.Dao.OperateData;
import com.example.administrator.baikangxing.MyApplication;
import com.example.administrator.baikangxing.R;
import com.example.administrator.baikangxing.config.Constants;

/**
 * Created by Sushil_Shen on 2017/4/17/0017.
 * Contact: Sushil_shen@163.com
 */

public class SelectItemHolder extends BaseHolder<String> {


    private TextView select_name;
    private ImageView select_eye;

    @Override
    protected View getHolderView() {
        View view = View.inflate(MyApplication.context, R.layout.select_item, null);
        select_name = (TextView) view.findViewById(R.id.select_item_tv_name);
        select_eye = (ImageView) view.findViewById(R.id.select_item_iv_eye);
        return view;
    }

    @Override
    public void bindData(String s) {
        select_name.setText(s);
        String select_device = OperateData.getStringData(MyApplication.context, Constants.SELECT_DEVICE_NAME);
        if(s.equals(select_device)){
            select_eye.setVisibility(View.VISIBLE);
        }else {
            select_eye.setVisibility(View.INVISIBLE);
        }
    }
}
